package cn.jly.spring.boot.cloud.beans;

import cn.jly.spring.boot.cloud.enums.GenderType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import javax.persistence.*;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import java.util.Date;

/**
 * @author lanyangji
 * @description user
 * @date 2020/11/25 下午 3:47
 */
@Accessors(chain = true)
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "tbl_user")
public class User {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    @NotEmpty(message = "username不能为空")
    @Column(name = "user_name")
    private String username;
    @Email(message = "email必须是一个合法的邮箱格式")
    private String email;
    @Enumerated(EnumType.STRING)
    private GenderType gender;
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time")
    private Date createTime;
}
